<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <base target="_blank" />
    <meta charset="utf-8" />
    <meta name="model_url" content="http://s.163.com/special/00313OO9/sc2.html" />
    <title>【官网主页】</title>
    <link rel="stylesheet" type="text/css" media="all" href="http://img1.cache.netease.com/game/static/css/blizzard-games-common.css" />
    <link rel="stylesheet" type="text/css" media="all" href="http://img2.cache.netease.com/game/blizzard/sc2/css/sc2-common-2018.css?v2" />
    <link rel="stylesheet" type="text/css" media="all" href="http://img4.cache.netease.com/game/blizzard/sc2/css/sc2-index-2018.css?v4" />
    <script type="text/javascript" src="http://img1.cache.netease.com/game/static/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="http://img1.cache.netease.com/game/static/js/jquery.SuperSlide.2.1.1.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <svg class="icons-data" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 64 64">
        <g id="Icon_blizzard">
            <path d="M59,15.206"></path>
            <path d="M33.083,41.167c0.312,0.195,1.304,0.883,1.519,1.036   c0.056,0.328,0.077,0.686,0.149,1.025c-0.348-0.133-5.094-0.064-5.482,0.036c-0.287,0.113-0.487,0.512-0.702,0.512   c-0.312,0-0.512-0.369-0.63-0.482c0.41-0.512,0.722-1.081,1.332-1.373c0.135-0.919,0.197-1.848,0.184-2.776l-0.01-20.988   c0.004-0.236-0.022-0.472-0.077-0.702c-0.184-0.512-1.826-1.148-1.998-1.296c0.1-0.194,0.223-0.375,0.369-0.538   c1.735,0.209,4.49,0.209,6.225,0c0.371,0.221,0.564,0.652,0.482,1.076c-0.558,0.179-1.537,0.692-1.48,1.445L33.083,41.167z"></path>
            <path d="M37.925,23.879l-0.737-0.192l-0.415-4.772l0.236-3.33l8.415,0.117l0.145,7.736   L38.833,40.5l7.447-5.003l-0.613,7.669l-9.75-0.25l2.25-11.5l5.167-13.75c0,0-0.542-0.083-2.833,0   C38.208,17.75,37.925,23.879,37.925,23.879z"></path>
            <polygon points="48.375,22.5 46.688,23.625 46.799,19.398 46.75,15.585 56.431,15.585    54,23.744 49,43.583 57.53,40.417 57.5,46.917 46.833,46.88 47.667,33.713 52.833,17.969 50.066,17.969  "></polygon>
            <path d="M20.438,15.313l0.125,1.063c0,0,2.938,1.563,1.563,2.688   c-0.063,2.125,0,26.688,0,26.688L19.5,48.563l4.625-1.125l18.5,1.5l-0.827-4.793l-15.986,0.963c0,0,0-24.42,0-26.482   S20.438,15.313,20.438,15.313z"></path>
            <path d="M19.188,31.188c0-4-2.596-4.783-2.596-4.783s2.659-3.029,2.659-6.779   s-3.875-3.75-3.875-3.75H6.75l-0.125,0.688L8,18.313v29.25l-1.183,0.706L7.37,48.78l2.692,0.095   C21.5,48.875,19.188,35.188,19.188,31.188z M15.188,40.813c-0.438,4-3.545,4.459-3.545,4.459l1.014-1.834V28.556   C15.377,29.55,15.625,36.813,15.188,40.813z M12.438,25.108V19c0,0,2.938-0.375,2.938,2.875S12.438,25.108,12.438,25.108z"></path>
        </g>
    </svg>
    <link rel="stylesheet" href="//static.ws.126.net/game/img13/common/assets/css/normalize.css"/>
    <link href="//static.ws.126.net/game/img16/index0031/css/global0031_o_4.css" rel="stylesheet" />
    <script src="//static.ws.126.net/cnews/js/ntes_jslib_1.x.js" type="text/javascript"></script>
    <style>
        .new-main{
            width: 40%;
            margin: 100px auto 20px;
            padding: 15px;
            background-color: #fff;
        }
        .new-main .item{
            margin-bottom: 20px;
        }
        .new-main .item-title{
            text-align: left;
            padding: 15px;
            font-weight: bold;
            font-size:18px;
        }
        .pagination-container{
            text-align: center;
        }
        .pagination{
            display: inline-block;
        }
        .pagination a{
            background-color: #999;
            color: #fff;
            padding: 1px 6px;
            text-decoration:none;
            border-radius: 5px;
            margin-right: 10px;
            cursor:pointer;
        }
        .pagination a.active{
            background-color: #85D1FF;
        }
        .page-change{
            margin: 18px 100px;
            cursor: pointer;
            width: 100px;
            height: 30px;
            background-color: #664400;
            border-color: #f49501;
            color: #f49501;
        }
        .skip input{
            width: 50px;
        }
    </style>
</head>
<!--onload="showBooks(1)"-->
<body onload="showBooks(1)">
<div class="ntes_nav_wrap">
<!--    <script src="//img6.cache.netease.com/game/img15/index0031/js/nav.byebye3.js" type="text/javascript"></script>-->
</div>
<div class="wrapper">
    <!-- Head -->
    <div class="head">
        <div class="content-container">
<!--            <a href="http://s.163.com/" class="csh-logo" target="_self"></a>-->
            <div class="menu-container clear">
                <div class="menu-bar">
                    <ul class="sitenav-menu">
                        <li><a href="" target="_self">在线人数:<%=application.getAttribute("count")%></a></li>
                        <li><a href="" target="_self">视频</a></li>
                        <li><a href="../logout-servlet" target="_self">退出</a></li>
                        <li><a href="../loginspc-servlet" target="_self">管理</a></li>
                        <li><a href="postingInfo.jsp" target="_self">追加</a></li>
                    </ul>
                </div>
                <div class="search-bar">
<!--                    <form method="get" action="">-->
                        <input type="button" id="search-button" class="search-icon" style="border: #664400" onclick="buttonClick();">
                        <input type="search" class="search-input"  value="" placeholder="输入关键字" autocomplete="off" tabindex="1" name="wd" id="inputs">
<!--                    </form>-->
                </div>
            </div>
        </div>
    </div>
    <!-- Body -->
    <div class="body">
        <div class="content-container clear">
                <div class="sidebar-esport-event">

                </div>
                <!-- Blizzard News -->
                <div class="sidebar-news">
                    <div class="sidebar-container">
                        <div class="sidebar-title">
                            <div class="game-icon">
                            </div>
                            <h2>设定集</h2>
                            <a href="http://play.163.com/special/sc2-news-list/" class="more"></a>
                        </div>
                        <div class="sidebar-content">
                            <ul class="sidebar-news-list" id="postTable">
                                                           </ul>

                                <div class="pagination-container">
                                    <button class="page-change prev" onclick="prevpage()">上一页</button>
                                    <button class="page-change next" onclick="nextpage()">下一页</button>
                                </div>
                    </div>
                </div>


        </div>
    </div>
</div>
<!-- 底部 start-->
<style type="text/css">
    .N-nav-bottom-main-l{width:188px;}
    .content-subfoot-bg{
        background: #03274f;
        padding: 30px 0px;
        margin-top: 30px;
    }
    .content-subfoot{
        width: 1200px;
        color: #fff;
        margin: 20px auto;
        font-size: 14px;
    }
    .content-subfoot a{
        color: #fff;
    }
    .content-subfoot a:hover{
        color:#0af;
    }
    .mod_hezuo h3{
        padding-bottom: 15px;
    }
    .mod_hezuo h3 span{
        font-size: 20px;
        border-top: 3px #1dafec solid;
        padding-top: 5px;
    }
    .content-subfoot .mod_info{
        text-align: right;
        margin-top: 20px;
    }
</style>
<!-- 底部 end-->
<!--<script type="text/javascript" src="http://img1.cache.netease.com/game/blizzard/static/js/slideshow.js"></script>-->
<!--<script type="text/javascript" src="http://s.163.com/special/00314Q9V/sc2-tips.js"></script>-->

<style>
    .N-nav-bottom-sub{width: 960px; margin:0 auto; position: relative; height: 0px; z-index: 1000; }
    .ne_foot_feedback_box{width: 360px; height: 270px; position: absolute; z-index: 9999; bottom: 34px; right: 0; display: none; }
    .ne_foot_feedback_box .feedback_close{width: 11px; height: 11px; background: url(http://img1.cache.netease.com/f2e/www/feedback/images/box_close.png) no-repeat; position: absolute; right: 8px; top: 7px; font-size: 0; overflow: hidden; text-indent: -9990em; }
    .ne_foot_feedback_box .feedback_cor{width: 19px; height: 13px; background: url(http://img1.cache.netease.com/f2e/www/feedback/images/box_cor.png) no-repeat; position: absolute; left: 236px; top: 250px; }
    .ne_foot_feedback_box .feedback_box{border:1px solid #cdcdcd; background: #fff; width: 358px; height: 250px; overflow: hidden; }
    .ne_foot_feedback_box .feedback_box iframe{display: block; border: 0; width: 100%; height: 250px; overflow: hidden; }
</style>
<div class="N-nav-bottom-sub" id="N-nav-bottom-sub"></div>


<script lang="javascript">

    function prevpage(){
        var p=sessionStorage.getItem("page")
        p=p-1;
        sessionStorage.setItem("page",p);
        showBooks(p);
    }

    function nextpage(){
        var p=sessionStorage.getItem("page")
        if (p==null)
            {p=p-1;
            p=p+2;}
        p=p-1;
        p=p+2;
        sessionStorage.setItem("page",p);
        showBooks(p);
    }

    function showBooks(page) {
        jQuery.ajax({
            url: "../posts?page=" + page,
            method: "GET",
            dataType: "json"
        }).done(function(result){
            updatePostTable(result.posts);
        }).fail(function(xhr, status){
            console.log(status);
        });
    }

    function updatePostTable(posts) {
        var t = jQuery("#postTable");
        t.empty();
        for (var i=0; i<posts.length; i++) {
            var b = posts[i];
             var tr =jQuery("<li>");
             tr.append(
                 "<a href="
                 + "\"./post.jsp?id=" +
                 b.id +
                 "\"><span className=\"article-date\" style='float: right;color: rgba(255,255,255,0.5);'>"
                 + b.author
                 + "</span>"
                 + b.title
                 + "</a></li>");
             t.append(tr);
        }}

    jQuery('#inputs').bind('keyup', function(event) {
        if (event.keyCode == "13") {
            //回车执行查询
            jQuery('#search-button').click();
        }
    });

    function buttonClick() {
        showposts();
    };

    function showposts() {
        var y=  document.getElementById("inputs")//获取输入框元素;
        x=y.value;
        console.log("输入内容为：%s",x);
        jQuery.ajax({
            url: "../search-servlet?key=" + x,
            method: "GET",
            dataType: "json"
        }).done(function(result){
            updatePostTableagain(result.posts);
        }).fail(function(xhr, status){
            console.log(status);
        });
    }

    function updatePostTableagain(posts) {
        var t = jQuery("#postTable");
        t.empty();
        for (var i=0; i<posts.length; i++) {
            var b = posts[i];
            var tr =jQuery("<li>");
            tr.append(
                "<a href="
                + "\"./post.jsp?id=" +
                b.id +
                "\"><span className=\"article-date\" style='float: right;color: rgba(255,255,255,0.5);'>"
                + b.author
                + "</span>"
                + b.title
                + "</a></li>");
            t.append(tr);
        }}



</script>

<!--<script src="https://static.ws.126.net/f2e/products/analysis/js/analysis0628.350ctAoOoFtN.1.js"></script>-->
</body>
</html>